package routes

import (
	"Management/api"
	"Management/middleware"
	"github.com/gin-gonic/gin"
)

func CollectRoute(r *gin.Engine) *gin.Engine {
	//登录
	loginerGroup:=r.Group("/loginer").Use(middleware.Cors).Use(middleware.Recover)
	{
		loginerGroup.POST("/query",api.QueryLoginer)
	}
	//部门
	departmentGroup:=r.Group("/department").Use(middleware.Cors).Use(middleware.Recover)
	{
		//查询所有部门
		departmentGroup.POST("/queryall", api.QueryAllDepartment)
		//添加新部门
		departmentGroup.POST("/add", api.AddDepartment)
		//删除部门
		departmentGroup.POST("/delete",api.DeleteDepartment)
		//修改部门
		departmentGroup.POST("/change",api.ChangeDepartment)
	}
	//部门人员
	userGroup:=r.Group("/user").Use(middleware.Cors).Use(middleware.Recover)
	{
		//分页查询该部门所有人员
		userGroup.POST("/querydepartment",api.QueryDepartmentUser)
		//删除部门人员
		userGroup.POST("/delete",api.DeleteUser)
		//修改部门人员
		userGroup.POST("/change",api.ChangeUser)
		//添加部门人员
		userGroup.POST("/add",api.AddUser)
		//分页模糊查询部门人员
		userGroup.POST("/querylike",api.QueryLikeUsers)
	}
	//前端页面查询token
	//r.POST("/checktoken",middleware.JwtMiddleware())
	return r
}
